﻿@using Microsoft.AspNetCore.Hosting
@using System.IO
@inject DemoMenuMeta meta
@inject IHostingEnvironment hosting
@functions {
    const string DEMO_TEMPLATE_URL = "~/css/demo-template.css";

    bool ContentExists(string url) {
        return File.Exists(url.Replace("~", hosting.ContentRootPath + "/wwwroot"));
    }
}

<link rel="stylesheet" href="~/bundle.min.css" asp-append-version="true">
<link rel="stylesheet" href="~/css/dx.@(DemoUtils.GetCurrentTheme(Context)).css" asp-append-version="true">

@if(!String.IsNullOrEmpty(DemoUtils.PRODUCT_CSS_BUNDLE_NAME)) {
<link rel="stylesheet" href="~/bundle-@(DemoUtils.PRODUCT_CSS_BUNDLE_NAME).min.css" asp-append-version="true">
}

@if(!String.IsNullOrEmpty(DemoUtils.PRODUCT_THEME_CSS_TEMPLATE)) {
<link rel="stylesheet" href="@String.Format(DemoUtils.PRODUCT_THEME_CSS_TEMPLATE, DemoUtils.GetCurrentTheme(Context))" asp-append-version="true">
}

@if(!DemoUtils.IsNavigationEnabled(Context) && ContentExists(DEMO_TEMPLATE_URL)) {
<link rel="stylesheet" href="@Url.Content(DEMO_TEMPLATE_URL)" asp-append-version="true">
}

@if(DemoUtils.IsNavigationEnabled(Context)) {
<link rel="stylesheet" href="~/DemoShell/css/site.css" asp-append-version="true">
}

@if(ContentExists(meta.CurrentDemo.AdditionalCssUrl)) {
<link rel="stylesheet" href="@Url.Content(meta.CurrentDemo.AdditionalCssUrl)" asp-append-version="true">
}

<script src="~/bundle.min.js" asp-append-version="true"></script>
